t == SH_type_fl1_pae_shadow ||
t == SH_type_fl1_64_shadow ||
t == SH_type_monitor_table ||
-#ifdef CONFIG_COMPAT
- (IS_COMPAT(v->domain) && t == SH_type_l4_64_shadow) ||
-#endif
+ (pv_32on64_vcpu(v) && t == SH_type_l4_64_shadow) ||
(page_get_owner(mfn_to_page(_mfn(sp->backpointer)))
== v->domain));
SHADOW_INTERNAL_NAME(sh_destroy_l1_shadow, 4, 4)(v, smfn);
break;
case SH_type_l2h_64_shadow:
- ASSERT( IS_COMPAT(v->domain) );
+ ASSERT(pv_32on64_vcpu(v));
/* Fall through... */
case SH_type_l2_64_shadow:
SHADOW_INTERNAL_NAME(sh_destroy_l2_shadow, 4, 4)(v, smfn);
}
#if (SHADOW_OPTIMIZATIONS & SHOPT_LINUX_L3_TOPLEVEL)
- if ( IS_COMPAT(d) )
+ /* 32bit PV guests on 64bit xen behave like older 64bit linux: they
+ * change an l4e instead of cr3 to switch tables. Give them the
+ * same optimization */
+ if ( pv_32on64_domain(d) )
d->arch.paging.shadow.opt_flags = SHOPT_LINUX_L3_TOPLEVEL;
#endif
d->domain_id, v->vcpu_id, mfn_x(gmfn),
shadow_type, mfn_x(smfn));
-#ifdef CONFIG_COMPAT
- if ( !IS_COMPAT(d) || shadow_type != SH_type_l4_64_shadow )
-#endif
+ /* 32-on-64 PV guests don't own their l4 pages so can't get_page them */
+ if ( !pv_32on64_vcpu(v) || shadow_type != SH_type_l4_64_shadow )
{
res = get_page(mfn_to_page(gmfn), d);
ASSERT(res == 1);
v->domain->domain_id, v->vcpu_id,
mfn_x(gmfn), shadow_type, mfn_x(smfn));
shadow_hash_delete(v, mfn_x(gmfn), shadow_type, smfn);
-#ifdef CONFIG_COMPAT
- if ( !IS_COMPAT(v->domain) || shadow_type != SH_type_l4_64_shadow )
-#endif
+ /* 32-on-64 PV guests don't own their l4 pages; see set_shadow_status */
+ if ( !pv_32on64_vcpu(v) || shadow_type != SH_type_l4_64_shadow )
put_page(mfn_to_page(gmfn));
}
// PV guests in 64-bit mode use two different page tables for user vs
// supervisor permissions, making the guest's _PAGE_USER bit irrelevant.
// It is always shadowed as present...
- if ( (GUEST_PAGING_LEVELS == 4) && !IS_COMPAT(d) && !is_hvm_domain(d) )
+ if ( (GUEST_PAGING_LEVELS == 4) && !pv_32on64_domain(d)
+ && !is_hvm_domain(d) )
{
sflags |= _PAGE_USER;
}
for ( _i = 0; _i < SHADOW_L2_PAGETABLE_ENTRIES; _i++ ) \
{ \
if ( (!(_xen)) \
- || !IS_COMPAT(_dom) \
+ || !pv_32on64_domain(_dom) \
|| mfn_to_shadow_page(_sl2mfn)->type != SH_type_l2h_64_shadow \
|| (_i < COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT(_dom)) ) \
{ \
__PAGE_HYPERVISOR);
}
- if ( IS_COMPAT(v->domain) )
+ if ( pv_32on64_domain(v->domain) )
{
/* install compat arg xlat entry */
sl4e[shadow_l4_table_offset(COMPAT_ARG_XLAT_VIRT_BASE)] =
int i;
#else
- if ( !pv_32bit_vcpu(v) )
+ if ( !pv_32on64_vcpu(v) )
return;
#endif
#endif
#if CONFIG_PAGING_LEVELS >= 3 && GUEST_PAGING_LEVELS >= 3
case SH_type_l2h_shadow:
-#ifdef CONFIG_COMPAT
- ASSERT( IS_COMPAT(v->domain) );
-#endif
sh_install_xen_entries_in_l2h(v, smfn); break;
#endif
#if CONFIG_PAGING_LEVELS == 2 && GUEST_PAGING_LEVELS == 2
l4e = sh_map_domain_page(m4mfn);
l4e[0] = l4e_from_pfn(mfn_x(m3mfn), __PAGE_HYPERVISOR);
sh_unmap_domain_page(l4e);
- if ( pv_32bit_vcpu(v) )
+ if ( pv_32on64_vcpu(v) )
{
// Install a monitor l2 table in slot 3 of the l3 table.
// This is used for all Xen entries.
shadow_l3e_t new_sl3e;
unsigned int t = SH_type_l2_shadow;
-#ifdef CONFIG_COMPAT
/* Tag compat L2 containing hypervisor (m2p) mappings */
- if ( IS_COMPAT(v->domain) &&
+ if ( pv_32on64_domain(v->domain) &&
guest_l4_table_offset(gw->va) == 0 &&
guest_l3_table_offset(gw->va) == 3 )
t = SH_type_l2h_shadow;
-#endif
+
/* No l2 shadow installed: find and install it. */
*sl2mfn = get_shadow_status(v, gw->l2mfn, t);
if ( !mfn_valid(*sl2mfn) )
l4_pgentry_t *l4e = sh_map_domain_page(mmfn);
ASSERT(l4e_get_flags(l4e[0]) & _PAGE_PRESENT);
m3mfn = _mfn(l4e_get_pfn(l4e[0]));
- if ( pv_32bit_vcpu(v) )
+ if ( pv_32on64_vcpu(v) )
{
/* Need to destroy the l2 monitor page in slot 3 too */
l3_pgentry_t *l3e = sh_map_domain_page(m3mfn);
(unsigned long)pagetable_get_pfn(v->arch.guest_table));
#if GUEST_PAGING_LEVELS == 4
- if ( !(v->arch.flags & TF_kernel_mode) && !IS_COMPAT(v->domain) )
+ if ( !(v->arch.flags & TF_kernel_mode) && !pv_32on64_vcpu(v) )
gmfn = pagetable_get_mfn(v->arch.guest_table_user);
else
#endif
mfn = shadow_l3e_get_mfn(*sl3e);
gmfn = get_shadow_status(v, audit_gfn_to_mfn(v, gfn, gl3mfn),
((GUEST_PAGING_LEVELS == 3 ||
- IS_COMPAT(v->domain))
+ pv_32on64_vcpu(v))
&& !shadow_mode_external(v->domain)
&& (guest_index(gl3e) % 4) == 3)
? SH_type_l2h_shadow